﻿namespace Offy.Itdev.BuyIn.Intranet.Presenters
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Views;

    /// <summary>
    /// Base Presenter Typed
    /// All the Presenters should inherit from this one and implement the methods
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public abstract class BasePresenter<T> where T : IBaseView
    {
        /// <summary>
        /// Typed View
        /// </summary>
        protected static T View;

        protected BasePresenter(){ }

        /// <summary>
        /// Registers the View to the Presenter
        /// </summary>
        /// <param name="myView">View type</param>
        public void RegisterView(T view)
        {
            if (view == null)
                throw new ArgumentNullException("View cannot be null.");

            View = view;
        }

        public virtual void OnViewInitialized(){}

        public virtual void OnViewLoaded(){}
    }
}
